$(function() {
  $('#start_record').click(function(){
	  $('#audio_recorder')[0].startRecording();
   
  });
  
  $('#stop_record').click(function(){
	  $('#audio_recorder')[0].stopRecording();
  });
  
  $('#upload_record').click(function(){
	  $('#audio_recorder')[0].startUpload("http://localhost/test/uploader.php", "uploadedfile");
  });
  
  $('#play_record').click(function(){
	  $('#audio_recorder')[0].startPlayback();
  });
  
  $('#stop_play_record').click(function(){
	  $('#audio_recorder')[0].stopPlayback();
  });
  
  $('#label_status').text("page loaded");
  
  $('#progressbar').progressbar({ value:0 });
  //$('#progressbar').progressbar("widget").css("height","1em");
  $('#progressbar').css("height","1em");
});


function boo_recorder_trampoline()
{
  var args=$.makeArray(arguments);
  $('#label_status').text("some message comes from applet "  + args[1]+ "  ");
  
  if( args[1]== "_updateTimecode")
  {
    if(args[2] != args[3])
    {
      var progressVal = Math.ceil(args[2]*100/args[3]);
      $('#progressbar').progressbar({ value: progressVal });
    }
  }
  
}